Skip to content

Conversation

debs-obrien
Copy link
Member

added example of sass loader and explanation of why it goes at the end in order to work

added example of sass loader and explanation of why it goes at the end in order to work
Copy link
Member

@jeremenichelli jeremenichelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the contribution brings value, just need some rephrasing :)


[`module.rules`](/configuration/module/#module-rules) allows you to specify several loaders within your webpack configuration.
This is a concise way to display loaders, and helps to maintain clean code. It also offers you a full overview of each respective loader:
This is a concise way to display loaders, and helps to maintain clean code. It also offers you a full overview of each respective loader. Loaders work in a backwards order, from the last one to the first one. The sass loader will work first compiling your sass to css and then it will call the css loader and then the style loader. In order for the sass loader to work it needs to be at the end as sass will be the first thing that gets compiled. If you are not working with sass then you won't need the sass-loader.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the explanation is valuable though it might need some tweaking.

First, when you say helps maintain clean code we need to specify why it's that, if not I would remove this part.

Before The sass loader I would emphasize that this is how this would work in the code snippet below, like: In the example above the sass loader....

Also, please leave a line break after the new paragraph so it's visible for others contributors that a new paragraph is kicking off.

Copy link
Member

@montogeek montogeek Jul 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This order thing is already documented elsewhere, it is better to link to it.
Here, exactly: https://webpack.js.org/concepts/loaders/#loader-features

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok changes made, @jeremenichelli I never changed the first part about helping to maintain clean code so not sure if I should be the one to remove it. I believe it refers to having them nicely separated so when you add more loader options its cleaner and easier to read than all inline.

updated the text and added the link to where the loader order is mentioned
This is a concise way to display loaders, and helps to maintain clean code. It also offers you a full overview of each respective loader:
This is a concise way to display loaders, and helps to maintain clean code. It also offers you a full overview of each respective loader.

In the example below note the order of the sass-loader. See ["Loader Features"](/concepts/loaders/#loader-features) for more information on order of loaders.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about: ... for more information about loaders order.?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Member

@Legends Legends left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loaders are evaluated/executed from right to left.
In the example below execution starts with sass-loader, continues with css-loader and finally ends with style-loader.
See "Loader Features" for more information about loaders order.

@debs-obrien
Copy link
Member Author

Yeh I quite like it better @Legends. I think the more info you give the better and although we kinda repeat the right to left in the more info on loader features I think it's important to be there. will change it and submit a pr and see what the others think

added more detail for sass loader text to describe a bit more about how the loaders are read from right to left
Copy link
Member

@Legends Legends left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@montogeek montogeek merged commit 1fdd670 into webpack:master Jul 30, 2018
@montogeek
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants